
*******************************************************************************************************************
*******************************************************************************************************************
****************                             Replication file for:                                         ********
**************** Understanding the Electoral Participation Gap: A Study of Racialized Minorities in Canada ********
*******************************************************************************************************************
*******************************************************************************************************************

version 17.0 



******* Define your working directory ********

cd "Your path"

use "merged data", clear

******* DV: turnout ********

replace turnout = . if citizen == 0
label variable turnout Turnout


******* List-wise deletion ********

drop if mi(turnout, id_6c, age, woman, edu, married, employed, income, property, religiosity, party_member, id_ethnicity, volunteer_civic, ///
pol_interest, pol_know, pid, inst_trust, g_trust, int_efficacy, ext_efficacy, immigration, id_canada)


******* Table 1: Level of Turnout by Ethnic Group and Immigration Status ********

svyset [pw=weight]
mean turnout if id_6c == 1 & immigration == 1 [pw=weight]
mean turnout if id_6c == 1 & immigration == 2 [pw=weight]
mean turnout if id_6c == 1 & immigration == 3 [pw=weight]
mean turnout if id_6c == 1 [pw=weight]

mean turnout if id_6c == 2 & immigration == 1 [pw=weight]
mean turnout if id_6c == 2 & immigration == 2 [pw=weight]
mean turnout if id_6c == 2 & immigration == 3 [pw=weight]
mean turnout if id_6c == 2 [pw=weight]

mean turnout if id_6c == 3 & immigration == 1 [pw=weight]
mean turnout if id_6c == 3 & immigration == 2 [pw=weight]
mean turnout if id_6c == 3 & immigration == 3 [pw=weight]
mean turnout if id_6c == 3 [pw=weight]

mean turnout if id_6c == 4 & immigration == 1 [pw=weight]
mean turnout if id_6c == 4 & immigration == 2 [pw=weight]
mean turnout if id_6c == 4 & immigration == 3 [pw=weight]
mean turnout if id_6c == 4 [pw=weight]

mean turnout if id_6c == 5 & immigration == 1 [pw=weight]
mean turnout if id_6c == 5 & immigration == 2 [pw=weight]
mean turnout if id_6c == 5 & immigration == 3 [pw=weight]
mean turnout if id_6c == 5 [pw=weight]

mean turnout if id_6c == 6 & immigration == 1 [pw=weight]
mean turnout if id_6c == 6 & immigration == 2 [pw=weight]
mean turnout if id_6c == 6 & immigration == 3 [pw=weight]
mean turnout if id_6c == 6 [pw=weight]


******* Rescaling continous variables from 0 to 1 ********

foreach v of varlist income religiosity pol_interest inst_trust int_efficacy ext_efficacy id_ethnicity volunteer_civic id_canada {
	sum `v'
	replace `v' = (`v' - `r(min)') / (`r(max)'-`r(min)')
}


******* Table B1: Summary statistics ********

eststo clear
estpost sum turnout id_6c age_cat woman edu married employed income property ///
pol_interest pol_know pid inst_trust g_trust int_efficacy ext_efficacy ///
religiosity volunteer_civic id_ethnicity immigration id_canada
esttab using summary_statistics.rtf,  cell(( ///
count(label(N)fmt(%9.0f)) ///
mean(label(Mean)fmt(%9.2f)) ///
sd(label(S.D.)fmt(%9.2f)) ///
min(label(Min.)fmt(%9.2f)) ///
max(label(Max.)fmt(%9.2f)) ///
)) label nonumber nomtitle replace note("Data: Canadian Election Study and Democracy Checkup.")

******* Main analysis: Table D1 and Figure 1 ********

** Baseline Model

eststo clear 

eststo m1: vce2way reg turnout ib(1).id_6c i.province i.survey, cluster(province survey)

** Full Model

eststo m2: vce2way reg turnout ib(1).id_6c ib(6).age_cat woman edu married employed income property pol_interest pol_know pid int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member i.immigration id_canada id_ethnicity i.province i.survey, cluster(province survey)

esttab m1 m2 using "Table D1.rtf",  ///
drop ( *.province *.survey _cons) b(3) se(3) r2(3) label nogap nonote nobaselevels replace ///
refcat(2.id_6c "Group ID (Ref.: White)" 1.age_cat "Age Group (Ref.: 65+)" 2.immigration "Immigration (Ref.: Non-immigrant)") ///
mtitle("Model 1" "Model 2")

coefplot m1 m2, drop(*.province *.survey _cons) msymbol(o) xline(0, lpattern(dash)) legend(label(2 "Baseline") label(4 "Full") ring(0) pos(1) col(1) size(small)) ///
headings(2.id_6c = "{bf:Ethnic Groups}" 1.age_cat = "{bf:Socioeconomics}" pol_interest = "{bf:Psycho. Engage.}" religiosity = "{bf:Mobiliz. & Embed.}") xsize(2) ysize(3) 

graph export "Figure 1.png", width(2400)  height(3600)  replace


******* Supplemental analysis using logit: Table D2  ********

** Baseline

eststo clear 

vce2way logit turnout ib(1).id_6c i.province i.survey, cluster(province survey)
estpost margins, dydx(2.id_6c 3.id_6c 4.id_6c 5.id_6c 6.id_6c) 
est store m1

** Full

vce2way logit turnout ib(1).id_6c ib(6).age_cat woman edu married employed income property pol_interest pol_know pid int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member i.immigration id_canada id_ethnicity i.province i.survey, cluster(province survey)
estpost margins, dydx(2.id_6c 3.id_6c 4.id_6c 5.id_6c 6.id_6c 1.age_cat 2.age_cat 3.age_cat 4.age_cat 5.age_cat woman edu married employed income property pol_interest pol_know pid int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member 2.immigration 3.immigration id_canada id_ethnicity) 
est store m2

esttab m1 m2 using "Table D2.rtf",  ///
b(3) se(3) r2(3) label nogap nonote nobaselevels replace ///
refcat(2.id_6c "Group ID (Ref.: White)" 1.age_cat "Age Group (Ref.: 65+)" 2.immigration "Immigration (Ref.: Non-immigrant)") ///
mtitle("Model 1" "Model 2" )




******* Main analysis: Gelbach decomposition ******** 

tab id_6c, gen(id_6c)
tab province, gen(province)
tab survey, gen(survey)
tab age_cat, gen(age)
tab immigration, gen(immigration)

eststo clear 

******* Individual variable contributions ******** 

* Asian group

eststo m1: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey2-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c2) 


* Indiginous group

eststo m2: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey2-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c3) 
 
* Black group

eststo m3: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey2-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c4) 

* Arab/Middle East group

eststo m4: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey2-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c5) 
 
* Latino group

eststo m5: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey2-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c6) 

******* Table 2: Decomposition of the Participation Gap ******** 

esttab m1 m2 m3 m4 m5 using "Table 2_1.rtf",  b(3) se(3) label mtitle("Asian" "Indiginous" "Black" "Arab" "Latino") nogap nonote nobaselevels replace


******* Block contributions ******** 

eststo clear 

* Asian group

eststo m1: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey2-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c2) 

* Indiginous group 

eststo m2: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey2-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c3) 
 
* Black group 

eststo m3: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey2-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c4) 

* Arab/Middle East group 

eststo m4: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey2-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c5) 
 
* Latino group 

eststo m5: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey2-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c6) 

******* Table 2: Decomposition of the Participation Gap ******** 

esttab m1 m2 m3 m4 m5 using "Table 2_2.rtf",  b(3) se(3) label mtitle("Asian" "Indiginous" "Black" "Arab" "Latino") nogap nonote nobaselevels replace



******* Table F1: Decomposition of the Participation Gap using the CES sample ******** 

eststo clear 

preserve 

keep if survey == 1 

** Individual variable contributions

* Asian group 

eststo m1: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c2) 


* Indiginous group

eststo m2: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c3) 
 
* Black group

eststo m3: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c4) 

* Arab/Middle East group

eststo m4: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c5) 
 
* Latino group

eststo m5: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c6) 

esttab m1 m2 m3 m4 m5 using "Table F1_1.rtf",  b(3) se(3) label mtitle("Asian" "Indiginous" "Black" "Arab" "Latino") nogap nonote nobaselevels replace

** Block contributions

eststo clear 

* Asian group 

eststo m1: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c2) 

* Indiginous group 

eststo m2: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c3) 
 
* Black group 

eststo m3: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c4) 

* Arab/Middle East group 

eststo m4: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c5) 
 
* Latino group 

eststo m5: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c6) 

esttab m1 m2 m3 m4 m5 using "Table F1_2.rtf",  b(3) se(3) label mtitle("Asian" "Indiginous" "Black" "Arab" "Latino") nogap nonote nobaselevels replace

restore


******* Table F2: Decomposition of the Participation Gap using the DC sample ******** 

eststo clear 

preserve 

keep if survey != 1 

** Individual variable contributions

* Asian group

eststo m1: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey3-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c2) 


* Indiginous group

eststo m2: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey3-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c3) 
 
* Black group

eststo m3: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey3-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c4) 

* Arab/Middle East group

eststo m4: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey3-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c5) 
 
* Latino group

eststo m5: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey3-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=immigration2 immigration3 : g19=id_canada : g20=id_ethnicity) x1only(id_6c6) 

esttab m1 m2 m3 m4 m5 using "Table F2_1.rtf",  b(3) se(3) label mtitle("Asian" "Indiginous" "Black" "Arab" "Latino") nogap nonote nobaselevels replace

** Block contributions

eststo clear 

* Asian group

eststo m1: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey3-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c2) 

* Indiginous group

eststo m2: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey3-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c3) 
 
* Black group

eststo m3: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey3-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c4) 

* Arab/Middle East group

eststo m4: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey3-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c5) 
 
* Latino group

eststo m5: b1x2 turnout, x1all(id_6c2-id_6c6 province2-province13 survey3-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member immigration2 immigration3 id_canada id_ethnicity) x1only(id_6c6) 

esttab m1 m2 m3 m4 m5 using "Table F2_2.rtf",  b(3) se(3) label mtitle("Asian" "Indiginous" "Black" "Arab" "Latino") nogap nonote nobaselevels replace

restore



******* Table E1: Immigration effect on participation among Asians and Blacks ******** 

eststo clear 

eststo m1: vce2way reg turnout i.immigration i.province i.survey if id_6c==2, cluster(survey province)
eststo m2: vce2way reg turnout i.immigration ib(6).age_cat woman edu married employed income property pol_interest pol_know pid int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member id_canada id_ethnicity i.province i.survey if id_6c==2, cluster(survey province)

eststo m3: vce2way reg turnout i.immigration i.province i.survey if id_6c==4, cluster(survey province)
eststo m4: vce2way reg turnout i.immigration ib(6).age_cat woman edu married employed income property pol_interest pol_know pid int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member id_canada id_ethnicity i.province i.survey if id_6c==4, cluster(survey province)

esttab m1 m2 m3 m4 using "Table E1.rtf",  ///
b(3) se(3) r2(3) label nogap nonote nobaselevels replace ///
refcat(2.immigration "Immigration (Ref.: Non-immigrant)" 1.age_cat "Age Group (Ref.: 65+)" ) ///
mtitle("Asian Baseline" "Asian Full" "Black Baseline" "Black Full")


******* Table E2. Decomposition of the Participation Gap on the Black Population ******** 

keep if id_6c==4

eststo clear 

eststo m1: b1x2 turnout, x1all(immigration2 immigration3 province2-province11 survey3-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member id_canada id_ethnicity) x1only(immigration2) 

eststo m2: b1x2 turnout, x1all(immigration2 immigration3 province2-province11 survey3-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=id_canada : g19=id_ethnicity) x1only(immigration2) 

eststo m3: b1x2 turnout, x1all(immigration2 immigration3 province2-province11 survey3-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member id_canada id_ethnicity) ///
x2delta(g1=age1-age5 woman edu married employed income property : g2= pol_interest ///
pol_know pid int_efficacy ext_efficacy inst_trust g_trust : g3=religiosity volunteer_civic party_member id_canada id_ethnicity) x1only(immigration3) 

eststo m4: b1x2 turnout, x1all(immigration2 immigration3 province2-province11 survey3-survey5) ///
x2all(age1-age5 woman edu married employed income property pol_interest pol_know pid ///
int_efficacy ext_efficacy inst_trust g_trust religiosity volunteer_civic party_member id_canada id_ethnicity) ///
x2delta(g1=age1-age5 : g2=woman : g3=edu : g4=married : g5=employed : g6=income : g7= property : g8= pol_interest : ///
g9=pol_know : g10=pid : g11=int_efficacy : g12=ext_efficacy : g13=inst_trust : g14=g_trust : g15=religiosity : g16=volunteer_civic : g17=party_member : ///
g18=id_canada : g19=id_ethnicity) x1only(immigration3) 

esttab m2 m4 using "Table E2_1.rtf",  b(3) se(3) label mtitle("Second Generation" "First Generation") nogap nonote nobaselevels replace

esttab m1 m3 using "Table E2_2.rtf",  b(3) se(3) label mtitle("Second Generation" "First Generation") nogap nonote nobaselevels replace